home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / unix / c / isatty < prev    next >
Text File  |  1996-11-09  |  897b  |  41 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/isatty,v $
  4.  * $Date: 1996/10/30 21:59:01 $
  5.  * $Revision: 1.2 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: isatty,v $
  10.  * Revision 1.2  1996/10/30 21:59:01  unixlib
  11.  * Massive changes made by Nick Burret and Peter Burwood.
  12.  *
  13.  * Revision 1.1  1996/04/19 21:35:27  simon
  14.  * Initial revision
  15.  *
  16.  ***************************************************************************/
  17.  
  18. static const char rcs_id[] = "$Id: isatty,v 1.2 1996/10/30 21:59:01 unixlib Rel $";
  19.  
  20. #include <errno.h>
  21. #include <unistd.h>
  22. #include <sys/types.h>
  23. #include <sys/dev.h>
  24. #include <sys/unix.h>
  25.  
  26. int
  27. isatty (int fd)
  28. {
  29.   register struct file *f;
  30.  
  31.   if (BADF (fd))
  32.     {
  33.       errno = EBADF;
  34.       return (-1);
  35.     }
  36.  
  37.   f = __u->file + fd;
  38.  
  39.   return (major (f->dev) == DEV_TTY);
  40. }
  41.